import 'package:flutter/material.dart';
import 'package:flutter_app/tabs/homePage/homePage.dart';
import 'package:flutter_app/tabs/connectPage/connect.dart';
import 'package:flutter_app/tabs/userpage/UserPage.dart';

class Tabs extends StatefulWidget {
  Tabs({Key key}) : super(key: key);

  @override
  _TabsState createState() => _TabsState();
}

class _TabsState extends State<Tabs> {
  int _currentIndex = 1;
  List _pageList = [
    ConnectPage(),
    HomePage(),
    MyUserPage(),
  ];
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      backgroundColor: Colors.white,
      //appBar: this._appBar[this._currentIndex],
      body: this._pageList[this._currentIndex],
      bottomNavigationBar: BottomNavigationBar(
        currentIndex: this._currentIndex,
        onTap: (int index) {
          setState(() {
            this._currentIndex = index;
          });
        },
        items: [
          BottomNavigationBarItem(icon: Icon(Icons.people), title: Text('社区')),
          BottomNavigationBarItem(icon: Icon(Icons.home), title: Text('主页')),
          BottomNavigationBarItem(
              icon: Icon(Icons.perm_identity), title: Text('个人'))
        ],
        unselectedItemColor: Color.fromRGBO(135, 201, 181, 0.5),
        selectedItemColor: Color.fromRGBO(0, 0, 0, 1),
        //fixedColor: Colors.green,
      ),
    );
  }
}
